import { Code, InlineCode } from '~/components/text/code'
import Link from '~/components/text/link'
import Note from '~/components/text/note'

export const meta = {
  editUrl: 'pages/docs/api/v2/api-docs-mdx/errors/deployments.mdx',
  lastEdited: '2019-10-17T14:44:04.000Z'
}

## Deployment Errors

These error code could happen when using any [deployment related endpoint](#endpoints/deployments).

### Missing Files

Some of the files you defined when creating the deployment are missing.

<Code lang="json">{`{
  "error": {
    "code": "missing_files",
    "message": "Missing files",
    "missing": []
  }
}`}</Code>

### No Files in the Deployment

You tried to create an empty deployment.

<Code lang="json">{`{
  "error": {
    "code": "no_files",
    "message": "No files in the deployment"
  }
}`}</Code>

### Too Many Environment Variables

The limit of environment variables per deployment is 100 and you defined more. The error message indicates the amount you define.

<Code lang="json">{`{
  "error": {
    "code": "env_too_many_keys",
    "message": "Too many env vars have been supplied (100 max allowed, but got #)"
  }
}`}</Code>

<Note>
  <InlineCode>#</InlineCode> is your number of variables.
</Note>

### Environment Variable Key with Invalid Characters

Some environment variable name contains an invalid character. The only valid characters are letters, digits and `_`.

The error message will contain the `KEY` with the problem.

<Code lang="json">{`{
  "error": {
    "code": "env_key_invalid_characters",
    "message": "The env key "KEY" contains invalid characters. Only letters, digits and \`_\` are allowed",
    "key": KEY
  }
}`}</Code>

### Environment Variable Key with a Long Name

An environment variable name is too long, the maximum permitted name is 256 characters.

The error message contains the environment `KEY`.

<Code lang="json">{`{
  "error": {
    "code": "env_key_invalid_length",
    "message": "The env key "KEY" exceeds the 256 length limit",
    "key": KEY
  }
}`}</Code>

### Environment Variable Value with a Long Name

An environment variable value contains a value too long, the maximum permitted value is 65536 characters.

The error message contains the environment `KEY`.

<Code lang="json">{`{
  "error": {
    "code": "env_value_invalid_length",
    "message": "The env value for "KEY" exceeds the 65536 length limit",
    "key": KEY,
    "value": VALUE
  }
}`}</Code>

### Environment Variable Value Is an Object without UID

The value of an environment variable is object but it doesn't have a `uid`.

The error message contains the environment `KEY` which has the error.

<Code lang="json">{`{
  "error": {
    "code": "env_value_invalid_type_missing_uid",
    "message": "The env key "KEY" passed an object as a value with no \`uid\` key"
  }
}`}</Code>

### Environment Variable Value Is an Object with Unknown Props

The value of an environment variable is an object with unknown attributes, it only can have a `uid` key inside the object.

<Code lang="json">{`{
  "error": {
    "code": "env_value_invalid_type_unknown_props",
    "message": "The env key "KEY" passed an object with unknown properties. Only \`uid\` is allowed when passing an object"
  }
}`}</Code>

### Environment Variable Value with an Invalid Type

An environment variable value passed is of an unsupported type.

The error message contains the environment `KEY`.

<Code lang="json">{`{
  "error": {
    "code": "env_value_invalid_type",
    "message": "The env key "KEY" passed an unsupported type for its value",
    "key": KEY
  }
}`}</Code>

### Not Allowed to Access a Secret

You're tryin to use a secret but you don't have access to it.

<Code lang="json">{`{
  "error": {
    "code": "env_secret_forbidden",
    "message": "Not allowed to access secret \\"NAME\\"",
    "uid": UID
  }
}`}</Code>

### Missing Secret

You're trying to use a secret as an environment value and it doesn't exists.

<Code lang="json">{`{
  "error": {
    "code": "env_secret_missing",
    "message": "Could not find a secret by uid "UID"",
    "uid": UID
  }
}`}</Code>
